/*
 * @Description:webpack配置
 * @Author: r_yuesheng
 * @Date: 2021-07-08 15:01:48
 * @LastEditTime: 2022-04-07 13:13:21
 * @LastEditors: r_yuesheng
 */
const CracoLessPlugin = require('craco-less');
const path = require('path');

const pathResolve = pathUrl => path.join(__dirname, pathUrl);

module.exports = {
  webpack: {
    alias: {
      '@': pathResolve('src')
    }
  },
  devServer: {
    host: 'localhost',
    port: 7018,
    open: true
  },
  babel: {
    plugins: [
      ['import', { libraryName: 'antd', style: true }],
      ['@babel/plugin-proposal-decorators', { legacy: true }]
    ]
  },
  plugins: [
    {
      plugin: CracoLessPlugin,
      options: {
        // 此处根据 less-loader 版本的不同会有不同的配置，详见 less-loader 官方文档
        lessLoaderOptions: {
          lessOptions: {
            modifyVars: {},
            javascriptEnabled: true
          }
        }
      }
    }
  ]
};
